var ajaxUtils=(function(){
    function ajaxRequest(method,url,callback){
        let xhr=new XMLHttpRequest();
        if(method.toLowerCase()=="get"){
            xhr.open('get',url,true);
        }else if(method.toLowerCase()=="post"){
            xhr.open('post',url,true);
            xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        }else{
            console.log('parameter error');
        }
        xhr.addEventListener("readystatechange",()=>{
            if(xhr.readyState==4&&xhr.status==200){
                callback();
            }
        },false);
        xhr.send();
    }
    return {ajaxRequest:ajaxRequest};
})();